<template>
  <view style="background-color: darkcyan;margin-top:15px;">
    <view class="" style="font-size: 50rpx;">子组件B</view>
    <view class="">
      A组件传来的值:
      <text>{{result}}</text> 
    </view>
    <view class="">
      <text>回传值: </text>
      <input type="text" v-model="callbackValue" style="color: yellow;"/> 
      <button @click="sendOutSide()" size="mini">回传</button>
    </view>
  </view>
</template>

<script>
export default {
  name: "intenttextB",
  props: {
    fromA: {
      type: [String, Number],
      default: ''
    }
  },
  data() {
    return {
      result: '',       
      callbackValue: ''  
    }
  },
  watch: {
    fromA(newVal) {
      this.result = newVal; 
    }
  },
  methods: {
    sendOutSide() {
      this.$emit('sendBack', this.callbackValue); 
    }
  }
};
</script>